package com.ny.service.impl;

import com.ny.dao.ProductDao;
import com.ny.dao.impl.ProductDaoImpl;
import com.ny.entity.Product;
import com.ny.service.ProductService;

import java.sql.SQLException;
import java.util.List;

public class ProductServiceImpl implements ProductService {
    private ProductDao productDao = new ProductDaoImpl();
    @Override
    public List<Product> selectAllProduct() throws SQLException {
        return productDao.selectAllProduct();
    }
    @Override
    public Product getProductById(int productId) throws SQLException {
        return productDao.getProductById(productId);
    }

    @Override
    public int insertProduct(Product product) throws SQLException {
        return productDao.insertProduct(product);
    }

    @Override
    public int updateProduct(Product product) throws SQLException {
        return productDao.updateProduct(product);
    }

    @Override
    public int deleteProduct(int productId) throws SQLException {
        return productDao.deleteProduct(productId);
    }
}
